package com.geektime.hello.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.concurrent.atomic.AtomicInteger;

@Slf4j
@EnableScheduling
@Component
public class SpringJob {

    private final AtomicInteger times = new AtomicInteger();

    @Scheduled(cron = "0/10 * * * * ?")
    public void execute() {
        log.info("【execute执行次数】times=" + times.incrementAndGet());
    }

}
